package com.itheima.controller;


import com.itheima.common.Result;
import com.itheima.pojo.Dept;
import com.itheima.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
public class DeptController {

    @Autowired
    private DeptService deptService;

    @GetMapping("/depts")
    public Result list(){
        //1. 调用deptService
        List<Dept> deptList = deptService.queryDeptList();
        //2. 响应数据
        return Result.success(deptList);
    }

}